/**
 * JAVACC DEMO 1.0
 * @copy right dwusoft company All rights reserved. 
 * @Package com.apache.bid.service.cacheplugins  
 */
package com.apache.bid.service.cacheplugins;

import com.apache.api.manager.PluginConnector;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultEntity;
import com.apache.bid.common.Constant;
import com.apache.bid.service.plugins.UnityItemPluginHelper;

/**
 * description:  结束标的
 * @author Hou Dayu 创建时间：2016-3-25  
 * 
 */
public class EndItemPluginImpl implements PluginConnector {

	/**
	 * TODO 简单描述该方法的实现功能（可选）.  
	 * @see com.zbxsoft.api.manager.PluginConnector#execute(com.zbxsoft.api.vo.ParamsVo)  
	 */
	public Object execute(ParamsVo param) throws Exception {
		String objId = String.valueOf(param.getParams("syncObjId"));
		Constant.getInstance().setJingjiaMap(objId, objId);
		final String key = Constant.getInstance().getJingjiaMap(objId);
		//BidCacheManager cache = BidCacheFactory.getInstance().getCacheManager("item");
		synchronized (key) {
			String itemId = String.valueOf(param.getParams("itemId"));
			UnityItemPluginHelper.getInstance().stopItem(itemId);
		}
		ResultEntity entity = new ResultEntity();
		entity.setEntity("true");
		entity.setResult("true");
		entity.setMessage("标的结束成功");
		return entity;
	}
}
